<template>
  <a-spin :spinning="confirmLoading">
    <a-form-model ref="form" :model="models" :rules="validatorRules">
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="platform" required label="选择语气">
        <a-radio-group name="tenantStatus" v-model="model.platform">
                <a-radio value="0">有说服力</a-radio>
                <a-radio value="1">正式得体</a-radio>
                <a-radio value="2">专业</a-radio>
                <a-radio value="3">幽默</a-radio>
                <a-radio value="4">热情</a-radio>
              </a-radio-group>
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="eng" required label="文章标题">
        <a-radio-group name="tenantStatus" v-model="model.eng">
                <a-radio value="0">中文</a-radio>
                <a-radio value="1">英文</a-radio>
              </a-radio-group>
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productDescribe" required label="标题">
        <a-input placeholder="人工智能" v-model="models.productName" />
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productDescribe" required label="作文大纲">
        <a-input placeholder="人工智能就业方向" v-model="models.productName" />
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productDescribe" required label="关键词">
        <a-input placeholder="人工智能" v-model="models.productName" />
      </a-form-model-item>
      <a-form-model-item :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productDescribe" required label="想写什么">
        <a-textarea :rows="5" v-model="models.productDescribe" placeholder="人工智能未来的发展和就业前景" />
      </a-form-model-item>
    </a-form-model>
  </a-spin>
</template>

<script>
export default {
  name: 'NewMedia',
  components: {},
  props: {
    model: {
      type: Object,
      default: {},
    },
  },

  data() {
    return {
      addIconShow: true,
      shoppIngIcon: '',
      models: this.model,
      confirmLoading: false,
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 12 },
      },
      validatorRules: {
        platform: [{ required: true, message: '请选择平台' }],
        eng: [{ required: true, message: '请选择平台' }],
        platform: [{ required: true, message: '请选择平台' }],
        productDescribe: [{ required: true, message: '请输入商品描述' }],
      },
    }
  },

  created() {},
  computed: {
    models1() {
      return this.models
    },
  },
  watch: {
    models1: {
      handler(newVal, oldVal) {
        // console.log('newVal + oldVal',newVal, oldVal)
        // console.log('handler',newVal,  this.model)
        if (!newVal.platform) {
          //只需判断一个即可
          this.model.platform = '1'
        }
      },
      deep: true,
      immediate: true,
    },
  },
  updated() {},
  mounted() {
    this.$nextTick(function () {
      console.log('11111111111111111', this.models)
    })
  },
  methods: {
    generatedBtnProp() {
      let obj = {
        platform: this.models.platform,
        platform: this.models.platform,
        platform: this.models.platform,
        productDescribe: this.models.productDescribe,
      }
      this.$refs.form.validate((valid) => {
        if (valid) {
          this.$emit('appApiAsk', 1, obj)
        } else {
          this.$emit('appApiAsk', 2, obj)
        }
      })
    },
  },
}
</script>

<style lang="less">
</style>